import pandas as pd


# 将检测结果保存至excel的方法函数

def saveDetectAsExl(savePath,
                    countGranularSludge,
                    countEpistylis,
                    countFloc,
                    countRotifer,
                    countFilamentousbacteria,
                    ):
    data = pd.DataFrame()

    ArrayGranularSludge = []
    ArrayEpistylis = []
    ArrayFloc = []
    ArrayRotifer = []
    ArrayFilamentousbacteria = []

    ArrayGranularSludge.append(countGranularSludge)
    ArrayEpistylis.append(countEpistylis)
    ArrayFloc.append(countFloc)
    ArrayRotifer.append(countRotifer)
    ArrayFilamentousbacteria.append(countFilamentousbacteria)

    data['Granular Sludge'] = ArrayGranularSludge
    data['Epistylis'] = ArrayEpistylis
    data['Floc'] = ArrayFloc
    data['Rotifer'] = ArrayRotifer
    data['Filamentous bacteria'] = ArrayFilamentousbacteria

    path = savePath + '/CountResult.xlsx'
    data.to_excel(path)


def saveRealAdAsExl(savePath,averageAd,averageFd):
    data = pd.DataFrame()
    data['Granular Sludge Ad / um'] = averageAd
    data['fractal dimension'] = averageFd
    path = savePath + '/Granular Sludge Ad&Fd Result.xlsx'
    data.to_excel(path)